<?php
require_once('include.php');
$bissextil = (((date('Y')-2000)%4==0) && (date('m')>2)) ? 1 : 0;
$q = "select membres.id as id, concat(prenom,' ',membres.nom) as membre, equipes.nom as equipe, ddn from membres left join membre_equipes on membres.id = membre_id left join equipes on equipe_id = equipes.id where (dayofyear(ddn)+$bissextil) >= mod(365 + dayofyear(curdate()),365) and dayofyear(ddn) <= mod(365 + dayofyear(date_add(curdate(), interval 7 day)),365) and site = 1 order by date_format(ddn,'%m%d')";
$r = ExecRequete($q);
$anni = array();
while($s = LigneSuivante($r)){
	$anni[$s->id] = "<tr><td>".(CapitalizeLastName(strtolower($s->membre)))."</td><td>".$s->equipe."</td><td class = 'center'>".(format_date($s->ddn,'d.m','anniv'))."</td></tr>";
}
if(count($anni)) echo "<table>";
foreach($anni as $id => $text){
	echo $text;
}	

if(count($anni)) echo "</table>";
else echo "<p class = 'center italic fade'>pas d'anniversaire ces prochains jours</p>\n";
?>